import App from './App'

// 解决滚轮事件监听器警告
if (typeof window !== 'undefined') {
  // 重写 addEventListener 方法，为滚动相关事件添加 passive 选项
  const originalAddEventListener = EventTarget.prototype.addEventListener;
  EventTarget.prototype.addEventListener = function(type, listener, options) {
    if (typeof options === 'boolean') {
      options = { capture: options };
    }
    if (!options) {
      options = {};
    }
    
    // 为滚动相关事件设置 passive: true
    if (['wheel', 'mousewheel', 'touchstart', 'touchmove'].includes(type)) {
      options.passive = options.passive !== false;
    }
    
    return originalAddEventListener.call(this, type, listener, options);
  };
}

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif